Fish living on the sea bottom benefit by being flat and hugging the contours. There are two very different kinds of flat fish living on the sea bottom, and they have evolved their flatness in quite different ways. The skates and rays, relatives of sharks, have become flat in what might be called the obvious way. Their bodies have grown out sideways to form great 'wings'. They are like sharks that have passed under a steam roller, but they remain symmetrical and 'the right way up'. Plaice, sole, halibut and their relatives have become flat in a different way. They are bony fish (with swimbladders) related to herrings, trout, etc., and are nothing to do with sharks. Unlike sharks, bony fish as a rule have a marked tendency to be flattened in a vertical direction. A herring, for instance, is much 'taller' than it is wide. It uses its whole, vertically flattened body as a swimming surface, which undulates through the water as it swims. It was natural, therefore, that when the ancestors of plaice and sole took to the sea bottom, they should have lain on one side rather than on the belly like the ancestors of skates and rays. But this raised the problem that one eye was always looking down into the sand and was effectively useless. In evolution this problem was solved by the lower eye 'moving' round to the upper side.
We see this process of moving round re-enacted in the development of every young bony flatfish. A young flatfish starts life swimming near the surface, and it is symmetrical and vertically flattened just like a herring. But then the skull starts to grow in a strange, asymmetrical, twisted fashion, so that one eye, for instance the left, moves over the top of the head to finish up on the other side. The young fish settles on the bottom, with both its eyes looking upwards, a strange Picasso-like vision. Incidentally, some species of flatfish settle on the right side, others on the left, and others on either side.
The whole skull of a bony flatfish retains the twisted and distorted evidence of its origins. Its very imperfection is powerful testimony of its ancient history, a history of step-by-step change rather than of deliberate design. No sensible designer would have conceived such a monstrosity if given a free hand to create a flatfish on a clean drawing board. I suspect that most sensible designers would think in terms of something more like a skate. But evolution never starts from a clean drawing board. It has to start from what is already there. In the case of the ancestors of skates this was free-swimming sharks. Sharks in general aren't flattened from side to side as free-swimming bony fish like herrings are. If anything, sharks are already slightly flattened from back to belly. This meant that when some ancient sharks first took to the sea bottom, there was an easy smooth progression to the skate shape, with each intermediate being a slight improvement, given bottom conditions, over its slightly less flattened predecessor.
On the other hand, when the free-swimming ancestor of plaice and halibut, being, like a herring, vertically flattened from side to side, took to the bottom, it was better off lying on its side than balancing precariously on its knife edge of a belly! Even though its evolutionary course was eventually destined to lead it into the complicated and probably costly distortions involved in having two eyes on one side, even though the skate way of being a flat fish might ultimately have been the best design for bony fish too, the would-be intermediates that set out along this evolutionary pathway apparently did less well in the short term than their rivals lying on their side. The rivals lying on their side were so much better, in the short term, at hugging the bottom. In genetic hyperspace, there is a smooth trajectory connecting free-swimming ancestral bony fish to flatfish lying on their side with twisted skulls. There is not a smooth trajectory connecting these bony fish ancestors to flatfish lying on their belly. There is such a trajectory in theory, but it passes through intermediates that would have been in the short term, which is all that matters - unsuccessful if they had ever been called into existence.